import request from '@/utils/request'

// 查询库存信息列表
export function listInventory(query) {
  return request({
    url: '/stock/inventory/list',
    method: 'post',
    data: query
  })
}

// 查询库存信息详细
export function getInventory(id) {
  return request({
    url: '/stock/inventory/' + id,
    method: 'get'
  })
}

// 查询安全库存列表
export function listSafe(query) {
  return request({
    url: '/stock/inventory/safelist',
    method: 'post',
    data: query
  })
}

// 更新安全库存
export function updateSafeQty(data) {
  return request({
    url: '/stock/inventory/updateSafeQty',
    method: 'post',
    data: data
  })
}

//根据客户，skuId，规格数量来获取成本价
export function findStockInventoryBySkuId(skuId){
  return request({
    url: '/stock/inventory/findStockInventoryBySkuId?skuId='+skuId ,
    method: 'get'
  })
}

//根据仓库id,库位id，skuId来获取库存
export function findByWareAndSkuId(warehouseId,warelocationId,skuId){
  return request({
    url: '/stock/inventory/findByWareAndSkuId?warehouseId='+ warehouseId +'&warelocationId='+ warelocationId +'&skuId='+skuId ,
    method: 'get'
  })
}

//根据仓库id,库位id，skuId来获取库存
export function findCheckDataByWarehouseId(warehouseId){
  return request({
    url: '/stock/inventory/findCheckDataByWarehouseId?warehouseId='+ warehouseId,
    method: 'get'
  })
}

export function updateSafeQtyBatch(data){
  return request({
    url: '/stock/inventory/updateSafeQtyBatch',
    method: 'post',
    data: data
  })
}

export function listExpireDateWarn(data){
  return request({
    url: '/stock/inventory/listExpireDateWarn',
    method: 'post',
    data: data
  })
}
